package com.eureka.server.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.eureka.server.event.EurekaInstanceRegisteredEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

/**
 * 服务注册事件
 *
 * @Author yin_q
 * @Date 2019/8/28 11:53
 * @Email yin_qingqin@163.com
 **/
@Configuration
@Slf4j
public class InstanceRegisterListener implements ApplicationListener<EurekaInstanceRegisteredEvent> {

    @Override
    public void onApplicationEvent(EurekaInstanceRegisteredEvent event) {
        log.info("服务：{}注册, IP {}", event.getInstanceInfo().getAppName(), event.getInstanceInfo().getIPAddr());
    }
}
